home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Aminet
/
misc
/
emu
/
Frodo.lha
/
src
/
Main.asm
< prev
Wrap
Assembly Source File
|
1995-01-25
|
32KB
|
1,524 lines
*
* Main.asm - Hauptprogramm des C64-Emulators/Einstellungsfenster
*
* Copyright (C) 1994-1995 by Christian Bauer
*
MACHINE 68020
INCLUDE "exec/types.i"
INCLUDE "exec/macros.i"
INCLUDE "exec/memory.i"
INCLUDE "exec/execbase.i"
INCLUDE "dos/dos.i"
INCLUDE "intuition/intuition.i"
INCLUDE "libraries/gadtools.i"
INCLUDE "libraries/asl.i"
INCLUDE "workbench/workbench.i"
INCLUDE "FrodoPrefs.i"
INCLUDE "Frodo_rev.i"
XREF _SysBase ;Startup
XREF _DOSBase
XDEF _main
XDEF _UtilityBase
XDEF _IntuitionBase
XDEF _GfxBase
XDEF _GadToolsBase
XDEF _AslBase
XDEF _EGSBase
XDEF _VilIntuiBase
XDEF _CiaBase
XDEF _MiscBase
XDEF ShowPrefs
XDEF MainTask
XREF TheRAM ;6510.asm
XREF TheBasic
XREF TheKernal
XREF TheChar
XREF TheColor
XREF Init6510
XREF Start6510
XREF Stop6510
XREF Wait6510
XREF Pause6510
XREF Resume6510
XREF Reset6526 ;6526.asm
XREF ChangedKeys
XREF CIACycles
XREF Joystick1On
XREF Joystick2On
XREF JoystickSwap
XREF KeyboardYZ
XREF OpenGraphics ;6569.asm
XREF CloseGraphics
XREF WaitForClick
XREF AmigaToFront
XREF EmulToFront
XREF DisplayID
XREF ScreenType
XREF NormalCycles
XREF BadLineCycles
XREF Reset6581 ;6581.asm
XREF UseSIDCard
XREF Open1541 ;1541.asm
XREF Close1541
XREF ChangedDirs
XREF CloseIEC
XREF ChangedIEC
XREF Dir8
XREF Dir9
XREF Dir10
XREF Dir11
XREF Drv8IsIEC
XREF Drv9IsIEC
XREF Drv10IsIEC
XREF Drv11IsIEC
XREF OtherIEC
SECTION "CODE",CODE
**
** Makros
**
; LongInt-Wert aus Integer-Gadget a0 lesen
GetInt MACRO ;Ziel
move.l gg_SpecialInfo(a0),a0
move.l si_LongInt(a0),\1
ENDM
**
** Hauptprogramm
**
; Task holen
_main move.l _SysBase,a6
sub.l a1,a1
JSRLIB FindTask
move.l d0,MainTask
; Libraries öffnen
moveq #37,d0
lea UtilityName,a1
JSRLIB OpenLibrary
move.l d0,_UtilityBase
beq NoUtility
moveq #37,d0
lea IntuiName,a1
JSRLIB OpenLibrary
move.l d0,_IntuitionBase
beq NoIntui
moveq #37,d0
lea GfxName,a1
JSRLIB OpenLibrary
move.l d0,_GfxBase
beq NoGfx
moveq #37,d0
lea GadToolsName,a1
JSRLIB OpenLibrary
move.l d0,_GadToolsBase
beq NoGadTools
moveq #38,d0
lea AslName,a1
JSRLIB OpenLibrary
move.l d0,_AslBase
beq NoAsl
moveq #37,d0
lea IconName,a1
JSRLIB OpenLibrary
move.l d0,_IconBase
beq NoIcon
moveq #5,d0
lea EGSName,a1
JSRLIB OpenLibrary
move.l d0,_EGSBase
moveq #2,d0
lea VilIntuiName,a1
JSRLIB OpenLibrary
move.l d0,_VilIntuiBase
lea CiaResName,a1
JSRLIB OpenResource
move.l d0,_CiaBase
beq NoCiaRes
lea MiscResName,a1
JSRLIB OpenResource
move.l d0,_MiscBase
beq NoMiscRes
; 68020 vorhanden?
move.l _SysBase,a0
move.w AttnFlags(a0),d0
btst #AFB_68020,d0
beq No68020Exit
; ScreenMode- und Directory-Requester holen
move.l _AslBase,a6
moveq #ASL_ScreenModeRequest,d0
lea ScreenReqTags,a0
JSRLIB AllocAslRequest
move.l d0,ScreenRequester
beq NoMemExit
moveq #ASL_FileRequest,d0
lea DirReqTags,a0
JSRLIB AllocAslRequest
move.l d0,DirRequester
beq NoMemExit
; Vorgegebene Einstellungen
move.w #63,PNormalCycles
move.w #23,PBadLineCycles
move.w #63,PCIACycles
clr.w PJoystick1On
move.w #-1,PJoystick2On
clr.w PJoystickSwap
clr.l PDisplayID
clr.w PScreenType
clr.b PDir8
clr.b PDir9
clr.b PDir10
clr.b PDir11
clr.w PUseSIDCard
clr.w KeyboardYZ
; Einstellungen laden
move.l _DOSBase,a6
move.l #PrefsFileName,d1
move.l #MODE_OLDFILE,d2
JSRLIB Open
move.l d0,d7
beq NoEmulPrefs
move.l d7,d1
move.l #ThePrefs,d2
move.l #PrefsLength,d3
JSRLIB Read
move.l d7,d1
JSRLIB Close
NoEmulPrefs
; Einstellungsfenster darstellen
clr.w PrefsFromEmul
bsr DoThePrefs
; Einstellungen übernehmen, wenn OK geklickt, sonst beenden
tst.l d7
beq Exit
bsr SetPrefs
; Tastaturbelegung einstellen
jsr ChangedKeys
; Dateikram vorbereiten
jsr Open1541
jsr ChangedIEC
bsr IECErrorReq
; Speicher für alles holen (die unteren Worte müssen mit den C64-Adressen
; übereinstimmen, außer CharROM)
move.l _SysBase,a6
move.l #$30000,d0 ;192K
move.l #MEMF_ANY|MEMF_CLEAR,d1
JSRLIB AllocVec
move.l d0,RAMBlock
beq NoMemExit
add.l #$ffff,d0 ;Auf xxxx0000 bringen
clr.w d0
move.l d0,TheRAM
add.l #$11000,d0
move.l d0,TheChar ;yyyy1000
add.l #$9000,d0
move.l d0,TheBasic ;yyyya000
add.l #$3800,d0
move.l d0,TheColor ;yyyyd800
add.l #$0800,d0
move.l d0,TheKernal ;yyyye000
; Sprungbefehl bei $10000 installieren,
; für den Fall, daß ein Programm den Wraparound bei $ffff macht
move.l TheRAM,a0
move.l #$4c000000,$10000(a0)
; ROMs laden
move.l _DOSBase,a6
move.l #BasicFileName,d1 ;Basic
move.l #MODE_OLDFILE,d2
JSRLIB Open
move.l d0,d7
beq NoBasicExit
move.l d0,d1
move.l TheBasic,d2
move.l #$2000,d3
JSRLIB Read
move.l d7,d1
JSRLIB Close
move.l #KernalFileName,d1 ;Kernal
move.l #MODE_OLDFILE,d2
JSRLIB Open
move.l d0,d7
beq NoKernalExit
move.l d0,d1
move.l TheKernal,d2
move.l #$2000,d3
JSRLIB Read
move.l d7,d1
JSRLIB Close
move.l #CharFileName,d1 ;Char
move.l #MODE_OLDFILE,d2
JSRLIB Open
move.l d0,d7
beq NoCharExit
move.l d0,d1
move.l TheChar,d2
move.l #$1000,d3
JSRLIB Read
move.l d7,d1
JSRLIB Close
; Betriebssystem patchen
move.l TheKernal,a0
move.w #$f200,$0d40(a0) ;IECOut
move.w #$f201,$0d23(a0) ;IECOutATN
move.w #$f202,$0d36(a0) ;IECOutSec
move.w #$f203,$0e13(a0) ;IECIn
move.w #$f204,$0def(a0) ;IECSetATN
move.w #$f205,$0dbe(a0) ;IECRelATN
move.w #$f206,$0dcc(a0) ;IECTurnaround
move.w #$f207,$0e03(a0) ;IECRelease
; Bildschirm öffnen
jsr OpenGraphics
cmp.l #1,d0
beq NoScreenExit
cmp.l #2,d0
beq NoMemExit
cmp.l #3,d0
beq NoEGSExit
cmp.l #4,d0
beq NoVilIntuiExit
cmp.l #5,d0
beq NoDisplayIDExit
cmp.l #6,d0
beq ScrTooSmallExit
; Alles initialisieren
jsr Reset6526
jsr Reset6581
jsr Init6510
; 6510 starten
jsr Start6510
tst.l d0
bne NoMemExit
; Auf Mausklick warten
jsr WaitForClick
; Programm beenden
bra Exit
*
* Fehlerbehandlung/Beenden
*
MACHINE 68000
No68020Exit lea No68020Req,a1
move.l _IntuitionBase,a6
sub.l a0,a0
move.l a0,a2
move.l a0,a3
JSRLIB EasyRequestArgs
bra NoCiaRes
MACHINE 68020
NoMemExit lea NoMemReq,a1
bra ReqExit
NoScreenExit lea NoScreenReq,a1
bra ReqExit
NoEGSExit lea NoEGSReq,a1
bra ReqExit
NoVilIntuiExit lea NoVilIntuiReq,a1
bra ReqExit
NoDisplayIDExit lea NoDisplayIDReq,a1
bra ReqExit
ScrTooSmallExit lea ScrTooSmallReq,a1
bra ReqExit
NoKernalExit lea NoKernalReq,a1
bra ReqExit
NoBasicExit lea NoBasicReq,a1
bra ReqExit
NoCharExit lea NoCharReq,a1
ReqExit move.l _IntuitionBase,a6
sub.l a0,a0
move.l a0,a2
move.l a0,a3
JSRLIB EasyRequestArgs
Exit jsr Stop6510
jsr Reset6581 ;Stoppt diesen Lärm!
jsr CloseGraphics
jsr CloseIEC
jsr Close1541
move.l _SysBase,a6
move.l RAMBlock,d0
beq 1$
move.l d0,a1
JSRLIB FreeVec
1$ move.l DirRequester,d0
beq 2$
move.l _AslBase,a6
move.l d0,a0
JSRLIB FreeAslRequest
2$ move.l ScreenRequester,d0
beq 3$
move.l _AslBase,a6
move.l d0,a0
JSRLIB FreeAslRequest
3$
MACHINE 68000
NoMiscRes
NoCiaRes move.l _SysBase,a6
move.l _VilIntuiBase,d0
beq NoVilIntui
move.l d0,a1
JSRLIB CloseLibrary
NoVilIntui move.l _EGSBase,d0
beq NoEGS
move.l d0,a1
JSRLIB CloseLibrary
NoEGS move.l _IconBase,a1
JSRLIB CloseLibrary
NoIcon move.l _AslBase,a1
JSRLIB CloseLibrary
NoAsl move.l _GadToolsBase,a1
JSRLIB CloseLibrary
NoGadTools move.l _GfxBase,a1
JSRLIB CloseLibrary
NoGfx move.l _IntuitionBase,a1
JSRLIB CloseLibrary
NoIntui move.l _UtilityBase,a1
JSRLIB CloseLibrary
NoUtility moveq #0,d0
rts
MACHINE 68020
**
** Preferences
**
*
* Preferences aus dem Emulator heraus
*
; C64 anhalten und nach hinten legen
ShowPrefs jsr Pause6510
jsr AmigaToFront
; Aktuelle Preferences holen
bsr GetPrefs
; Fenster öffnen und handhaben
move.w #-1,PrefsFromEmul
bsr DoThePrefs
; Prefs setzen, wenn OK geklickt
tst.l d7
beq 1$
bsr SetPrefs
jsr ChangedKeys
jsr ChangedDirs
jsr ChangedIEC
bsr IECErrorReq
1$
; C64 nach vorn holen und wieder starten
jsr EmulToFront
jsr Resume6510
rts
*
* Handhabung des Preferences-Fensters
*
; Fenster öffnen
DoThePrefs jsr SetupScreen
tst.l d0
bne PrefsError
jsr OpenPrefsWindow
tst.l d0
bne PrefsError
bsr SetGadgets
move.l PrefsWnd,ScreenReqWindow
move.l PrefsWnd,DirReqWindow
; EventLoop
EventLoop move.l _SysBase,a6
move.l PrefsWnd,a0
move.l wd_UserPort(a0),a0
JSRLIB WaitPort
GetEvent move.l _GadToolsBase,a6
move.l PrefsWnd,a0
move.l wd_UserPort(a0),a0
JSRLIB GT_GetIMsg
tst.l d0
beq EventLoop
move.l d0,a1
move.l im_Class(a1),TheClass
move.w im_Code(a1),TheCode
move.l im_IAddress(a1),TheGadget
JSRLIB GT_ReplyIMsg
; Klasse auswerten
move.l TheClass,d0
and.l #IDCMP_GADGETUP,d0
beq NotGadget
; GadgetUp
move.l TheGadget,a0
; OK
cmp.w #GD_OK,gg_GadgetID(a0)
bne 1$
moveq #-1,d7
bra PrefsDone
; Cancel
1$ cmp.w #GD_Cancel,gg_GadgetID(a0)
bne 2$
moveq #0,d7
bra PrefsDone
; Save
2$ cmp.w #GD_Save,gg_GadgetID(a0)
bne 4$
bsr SaveThePrefs
bra GetEvent
; Joystick1On
4$ cmp.w #GD_Joystick1On,gg_GadgetID(a0)
bne 5$
not.w PJoystick1On
bra GetEvent
; Joystick2On
5$ cmp.w #GD_Joystick2On,gg_GadgetID(a0)
bne 6$
not.w PJoystick2On
bra GetEvent
; JoystickSwap
6$ cmp.w #GD_JoystickSwap,gg_GadgetID(a0)
bne 7$
not.w PJoystickSwap
bra GetEvent
; GetDisplayID
7$ cmp.w #GD_GetDisplayID,gg_GadgetID(a0)
bne 8$
tst.w PrefsFromEmul ;Nur beim Start
bne GetEvent
move.l _AslBase,a6
move.l ScreenRequester,a0
move.l PDisplayID,ScreenReqID
lea DoScreenReqTags,a1
JSRLIB AslRequest
tst.l d0
beq GetEvent
move.l ScreenRequester,a0
move.l sm_DisplayID(a0),PDisplayID
bsr SetDisplayIDGad
bra GetEvent
; ScreenType
8$ cmp.w #GD_ScreenType,gg_GadgetID(a0)
bne 9$
tst.w PrefsFromEmul ;Nur beim Start
bne GetEvent
move.w TheCode,PScreenType
bra GetEvent
; Use SID Card
9$ cmp.w #GD_UseSIDCard,gg_GadgetID(a0)
bne 10$
not.w PUseSIDCard
bra GetEvent
; Drive 8 is on IEC cable
10$ cmp.w #GD_Drv8IsIEC,gg_GadgetID(a0)
bne 11$
not.w PDrv8IsIEC
beq 101$
lea DisableTags,a3
bra 102$
101$ lea EnableTags,a3
102$ lea PrefsGadgets,a0
move.l GDX_Dir8*4(a0),a0
move.l PrefsWnd,a1
sub.l a2,a2
JSRLIB GT_SetGadgetAttrsA
bra GetEvent
; Drive 9 is on IEC cable
11$ cmp.w #GD_Drv9IsIEC,gg_GadgetID(a0)
bne 12$
not.w PDrv9IsIEC
beq 111$
lea DisableTags,a3
bra 112$
111$ lea EnableTags,a3
112$ lea PrefsGadgets,a0
move.l GDX_Dir9*4(a0),a0
move.l PrefsWnd,a1
sub.l a2,a2
JSRLIB GT_SetGadgetAttrsA
bra GetEvent
; Drive 10 is on IEC cable
12$ cmp.w #GD_Drv10IsIEC,gg_GadgetID(a0)
bne 13$
not.w PDrv10IsIEC
beq 121$
lea DisableTags,a3
bra 122$
121$ lea EnableTags,a3
122$ lea PrefsGadgets,a0
move.l GDX_Dir10*4(a0),a0
move.l PrefsWnd,a1
sub.l a2,a2
JSRLIB GT_SetGadgetAttrsA
bra GetEvent
; Drive 11 is on IEC cable
13$ cmp.w #GD_Drv11IsIEC,gg_GadgetID(a0)
bne 14$
not.w PDrv11IsIEC
beq 131$
lea DisableTags,a3
bra 132$
131$ lea EnableTags,a3
132$ lea PrefsGadgets,a0
move.l GDX_Dir11*4(a0),a0
move.l PrefsWnd,a1
sub.l a2,a2
JSRLIB GT_SetGadgetAttrsA
bra GetEvent
; Get Directory for drive 8
14$ cmp.w #GD_GetDir8,gg_GadgetID(a0)
bne 15$
lea SetDir8Tags,a3
lea PDir8,a4
move.l #GD_Dir8,d4
bsr DoGetDirName
bra GetEvent
; Get Directory for drive 9
15$ cmp.w #GD_GetDir9,gg_GadgetID(a0)
bne 16$
lea SetDir9Tags,a3
lea PDir9,a4
move.l #GD_Dir9,d4
bsr DoGetDirName
bra GetEvent
; Get Directory for drive 10
16$ cmp.w #GD_GetDir10,gg_GadgetID(a0)
bne 17$
lea SetDir10Tags,a3
lea PDir10,a4
move.l #GD_Dir10,d4
bsr DoGetDirName
bra GetEvent
; Get Directory for drive 11
17$ cmp.w #GD_GetDir11,gg_GadgetID(a0)
bne 18$
lea SetDir11Tags,a3
lea PDir11,a4
move.l #GD_Dir11,d4
bsr DoGetDirName
bra GetEvent
; Use IEC cable for device numbers 4-15
18$ cmp.w #GD_OtherIEC,gg_GadgetID(a0)
bne 19$
not.w POtherIEC
bra GetEvent
; American keyboard layout
19$ cmp.w #GD_KeyboardYZ,gg_GadgetID(a0)
bne 20$
not.w PKeyboardYZ
bra GetEvent
20$ bra GetEvent
; Refresh
NotGadget move.l TheClass,d0
and.l #IDCMP_REFRESHWINDOW,d0
beq NotRefresh
move.l PrefsWnd,a0
JSRLIB GT_BeginRefresh
move.l PrefsWnd,a0
moveq #-1,d0
JSRLIB GT_EndRefresh
bra GetEvent
; Tastatur
NotRefresh move.l TheClass,d0
and.l #IDCMP_VANILLAKEY,d0
beq GetEvent
cmp.w #'o',TheCode ;O - OK
bne 1$
moveq #-1,d7
bra PrefsDone
1$ cmp.w #'s',TheCode ;S - Save
bne 2$
bsr SaveThePrefs
bra GetEvent
2$ cmp.w #'c',TheCode ;C - Cancel
bne 3$
moveq #0,d7
bra PrefsDone
3$ bra GetEvent
; Fertig mit den Prefs
PrefsDone bsr GetGadgets
jsr ClosePrefsWindow
PrefsError jsr CloseDownScreen
rts
*
* Auswahl eines Verzeichnisses
* a3: Zeiger auf Tags zum Ändern des zugehörigen Stringgadgets
* a4: Zeiger auf Puffer für Namen (256 Bytes)
* d4: ID des Stringgadgets, das anschließend geändert werden soll
*
DoGetDirName move.l a4,a0 ;Verzeichnisname kopieren
lea DirName,a1
moveq #256/4-1,d0
1$ move.l (a0)+,(a1)+
dbra d0,1$
move.l _AslBase,a6 ;Requester darstellen
move.l DirRequester,a0
lea DoDirReqTags,a1
JSRLIB AslRequest
tst.l d0
beq 3$
move.l DirRequester,a0 ;OK geklickt, Name zurückkopieren
move.l fr_Drawer(a0),a0
move.l a4,a1
moveq #256/4-1,d0
2$ move.l (a0)+,(a1)+
dbra d0,2$
move.l _GadToolsBase,a6 ;Name-Gadget neu setzen
lea PrefsGadgets,a0
move.l (a0,d4.w*4),a0
move.l PrefsWnd,a1
sub.l a2,a2 ;a3 enthält bereits den Zeiger auf die Tags
JSRLIB GT_SetGadgetAttrsA
3$ rts
*
* Gadgets setzen
*
SetGadgets move.l _GadToolsBase,a6
lea PrefsGadgets,a5
move.l GDX_NormalCycles*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetIntegerTags,a3
moveq #0,d0
move.w PNormalCycles,d0
move.l d0,SetIntTagsVal
JSRLIB GT_SetGadgetAttrsA
move.l GDX_BadLineCycles*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetIntegerTags,a3
moveq #0,d0
move.w PBadLineCycles,d0
move.l d0,SetIntTagsVal
JSRLIB GT_SetGadgetAttrsA
move.l GDX_CIACycles*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetIntegerTags,a3
moveq #0,d0
move.w PCIACycles,d0
move.l d0,SetIntTagsVal
JSRLIB GT_SetGadgetAttrsA
tst.w PJoystick1On
beq 2$
move.l GDX_Joystick1On*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
2$ tst.w PJoystick2On
beq 3$
move.l GDX_Joystick2On*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
3$ tst.w PJoystickSwap
beq 4$
move.l GDX_JoystickSwap*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
4$ tst.w PUseSIDCard
beq 5$
move.l GDX_UseSIDCard*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
5$ tst.w PDrv8IsIEC
beq 6$
move.l GDX_Drv8IsIEC*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
move.l GDX_Dir8*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea DisableTags,a3
JSRLIB GT_SetGadgetAttrsA
6$ tst.w PDrv9IsIEC
beq 7$
move.l GDX_Drv9IsIEC*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
move.l GDX_Dir9*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea DisableTags,a3
JSRLIB GT_SetGadgetAttrsA
7$ tst.w PDrv10IsIEC
beq 8$
move.l GDX_Drv10IsIEC*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
move.l GDX_Dir10*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea DisableTags,a3
JSRLIB GT_SetGadgetAttrsA
8$ tst.w PDrv11IsIEC
beq 9$
move.l GDX_Drv11IsIEC*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
move.l GDX_Dir11*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea DisableTags,a3
JSRLIB GT_SetGadgetAttrsA
9$ tst.w POtherIEC
beq 10$
move.l GDX_OtherIEC*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
10$ tst.w PKeyboardYZ
beq 11$
move.l GDX_KeyboardYZ*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCheckTags,a3
JSRLIB GT_SetGadgetAttrsA
11$ move.l GDX_ScreenType*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetCycleTags,a3
moveq #0,d0
move.w PScreenType,d0
move.l d0,SetCycTagsVal
JSRLIB GT_SetGadgetAttrsA
move.l GDX_Dir8*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetDir8Tags,a3
JSRLIB GT_SetGadgetAttrsA
move.l GDX_Dir9*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetDir9Tags,a3
JSRLIB GT_SetGadgetAttrsA
move.l GDX_Dir10*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetDir10Tags,a3
JSRLIB GT_SetGadgetAttrsA
move.l GDX_Dir11*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetDir11Tags,a3
JSRLIB GT_SetGadgetAttrsA
tst.w PrefsFromEmul ;Vom Emulator aufgerufen:
beq 1$ ; Bildschirmtyp und -modus
move.l GDX_GetDisplayID*4(a5),a0 ; ausschalten
move.l PrefsWnd,a1
sub.l a2,a2
lea DisableTags,a3
JSRLIB GT_SetGadgetAttrsA
move.l GDX_ScreenType*4(a5),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea DisableTags,a3
JSRLIB GT_SetGadgetAttrsA
1$ bra SetDisplayIDGad
*
* DisplayID-Gadget setzen
*
SetDisplayIDGad move.l _GfxBase,a6 ;DisplayID
sub.l a0,a0
lea ModeNameBuf,a1
moveq #nif_SIZEOF,d0
move.l #DTAG_NAME,d1
move.l PDisplayID,d2
JSRLIB GetDisplayInfoData
move.l _GadToolsBase,a6
lea PrefsGadgets,a0
move.l GDX_DisplayID*4(a0),a0
move.l PrefsWnd,a1
sub.l a2,a2
lea SetDIDTags,a3
JMPLIB GT_SetGadgetAttrsA
*
* Gadgets holen
*
GetGadgets lea PrefsGadgets,a1
move.l GDX_NormalCycles*4(a1),a0
GetInt d0
move.w d0,PNormalCycles
move.l GDX_BadLineCycles*4(a1),a0
GetInt d0
move.w d0,PBadLineCycles
move.l GDX_CIACycles*4(a1),a0
GetInt d0
move.w d0,PCIACycles
move.l GDX_Dir8*4(a1),a0
move.l gg_SpecialInfo(a0),a0
move.l si_Buffer(a0),a0
lea PDir8,a2
moveq #256/4-1,d0
11$ move.l (a0)+,(a2)+
dbra d0,11$
move.l GDX_Dir9*4(a1),a0
move.l gg_SpecialInfo(a0),a0
move.l si_Buffer(a0),a0
lea PDir9,a2
moveq #256/4-1,d0
12$ move.l (a0)+,(a2)+
dbra d0,12$
move.l GDX_Dir10*4(a1),a0
move.l gg_SpecialInfo(a0),a0
move.l si_Buffer(a0),a0
lea PDir10,a2
moveq #256/4-1,d0
13$ move.l (a0)+,(a2)+
dbra d0,13$
move.l GDX_Dir11*4(a1),a0
move.l gg_SpecialInfo(a0),a0
move.l si_Buffer(a0),a0
lea PDir11,a2
moveq #256/4-1,d0
14$ move.l (a0)+,(a2)+
dbra d0,14$
rts
*
* Einstellungen setzen
*
SetPrefs move.w PNormalCycles,NormalCycles
move.w PBadLineCycles,BadLineCycles
move.w PCIACycles,CIACycles
move.w PJoystick1On,Joystick1On
move.w PJoystick2On,Joystick2On
move.w PJoystickSwap,JoystickSwap
move.w PUseSIDCard,UseSIDCard
move.w PDrv8IsIEC,Drv8IsIEC
move.w PDrv9IsIEC,Drv9IsIEC
move.w PDrv10IsIEC,Drv10IsIEC
move.w PDrv11IsIEC,Drv11IsIEC
move.w POtherIEC,OtherIEC
move.w PKeyboardYZ,KeyboardYZ
tst.w PrefsFromEmul
bne 1$
move.l PDisplayID,DisplayID ;Nur beim Start
move.w PScreenType,ScreenType
1$
lea PDir8,a0
lea Dir8,a1
moveq #256/4-1,d0
11$ move.l (a0)+,(a1)+
dbra d0,11$
lea PDir9,a0
lea Dir9,a1
moveq #256/4-1,d0
12$ move.l (a0)+,(a1)+
dbra d0,12$
lea PDir10,a0
lea Dir10,a1
moveq #256/4-1,d0
13$ move.l (a0)+,(a1)+
dbra d0,13$
lea PDir11,a0
lea Dir11,a1
moveq #256/4-1,d0
14$ move.l (a0)+,(a1)+
dbra d0,14$
rts
*
* Einstellungen holen
*
GetPrefs move.w NormalCycles,PNormalCycles
move.w BadLineCycles,PBadLineCycles
move.w CIACycles,PCIACycles
move.w Joystick1On,PJoystick1On
move.w Joystick2On,PJoystick2On
move.w JoystickSwap,PJoystickSwap
move.w UseSIDCard,PUseSIDCard
move.w Drv8IsIEC,PDrv8IsIEC
move.w Drv9IsIEC,PDrv9IsIEC
move.w Drv10IsIEC,PDrv10IsIEC
move.w Drv11IsIEC,PDrv11IsIEC
move.w OtherIEC,POtherIEC
move.w KeyboardYZ,PKeyboardYZ
move.l DisplayID,PDisplayID
move.w ScreenType,PScreenType
lea Dir8,a0
lea PDir8,a1
moveq #256/4-1,d0
11$ move.l (a0)+,(a1)+
dbra d0,11$
lea Dir9,a0
lea PDir9,a1
moveq #256/4-1,d0
12$ move.l (a0)+,(a1)+
dbra d0,12$
lea Dir10,a0
lea PDir10,a1
moveq #256/4-1,d0
13$ move.l (a0)+,(a1)+
dbra d0,13$
lea Dir11,a0
lea PDir11,a1
moveq #256/4-1,d0
14$ move.l (a0)+,(a1)+
dbra d0,14$
rts
*
* Einstellungen speichern
*
SaveThePrefs bsr GetGadgets
move.l _DOSBase,a6 ;Datei öffnen
move.l #PrefsFileName,d1
move.l #MODE_NEWFILE,d2
JSRLIB Open
move.l d0,d6
beq 2$
move.l d6,d1 ;Einstellungen schreiben
move.l #ThePrefs,d2
move.l #PrefsLength,d3
JSRLIB Write
move.l d6,d1 ;Datei schließene
JSRLIB Close
move.l _IconBase,a6 ;Icon bereits vorhanden?
lea PrefsFileName,a0
JSRLIB GetDiskObject
tst.l d0
beq 1$
move.l d0,a0 ;Ja, dann nichts machen
JSRLIB FreeDiskObject
rts
1$ lea PrefsFileName,a0 ;Nein, Icon erzeugen
lea PrefsIcon,a1
JSRLIB PutDiskObject
2$ rts
*
* Requester entsprechend dem Rückgabewert von ChangedIEC anzeigen
* d0: Rückgabewert
*
IECErrorReq tst.l d0
beq 1$
cmp.l #1,d0
bne 2$
lea NoParPortReq,a1
bra 3$
2$ lea NoTimerReq,a1
3$ move.l a6,-(sp)
move.l _IntuitionBase,a6
sub.l a0,a0
move.l a0,a2
move.l a0,a3
JSRLIB EasyRequestArgs
move.l (sp)+,a6
1$ rts
**
** Konstanten
**
; Strings
Version VERSTAG
UtilityName dc.b "utility.library",0
IntuiName dc.b "intuition.library",0
GfxName dc.b "graphics.library",0
GadToolsName dc.b "gadtools.library",0
AslName dc.b "asl.library",0
IconName dc.b "icon.library",0
EGSName dc.b "egs.library",0
VilIntuiName dc.b "vilintuisup.library",0
CiaResName dc.b "ciaa.resource",0
MiscResName dc.b "misc.resource",0
PrefsFileName dc.b "PROGDIR:Frodo Prefs",0
BasicFileName dc.b "PROGDIR:Basic ROM",0
KernalFileName dc.b "PROGDIR:Kernal ROM",0
CharFileName dc.b "PROGDIR:Char ROM",0
ReqTitle dc.b "Frodo C64 Emulator",0
ReqGads dc.b "Beenden",0
ReqGads2 dc.b "Macht nichts",0
ScreenHailText dc.b "Wählen Sie einen Bildschirmmodus",0
DirHailText dc.b "Wählen Sie ein Verzeichnis",0
No68020Text dc.b "Frodo benötigt mindestens",10
dc.b "einen 68020 Prozessor.",0
NoMemText dc.b "Es steht nicht genügend Speicher zum",10
dc.b "Starten des Emulators zur Verfügung.",0
NoScreenText dc.b "Der C64-Bildschirm kann nicht",10
dc.b "eingerichtet werden.",0
NoEGSText dc.b "EGS ist auf Ihrem Amiga nicht",10
dc.b "installiert.",10
dc.b "Bitte wählen Sie 'Amiga' oder",10
dc.b "'Picasso' als Bildschirmtyp.",0
NoVilIntuiText dc.b "Die 'vilintuisup.library' ist",10
dc.b "auf Ihrem Amiga nicht installiert.",10
dc.b "Bitte wählen Sie 'Amiga' oder",10
dc.b "'EGS' als Bildschirmtyp.",0
NoDisplayIDText dc.b "Der gewählte Bildschirmmodus",10
dc.b "ist auf Ihrem Amiga nicht verfügbar.",0
ScrTooSmallText dc.b "Der von Ihnen gewählte Bildschirmmodus",10
dc.b "hat eine zu geringe Auflösung.",10
dc.b "Sie muß mindestens 384×288 betragen.",0
NoKernalText dc.b "Die Datei 'Kernal ROM' fehlt",10
dc.b "oder ist beschädigt.",0
NoBasicText dc.b "Die Datei 'Basic ROM' fehlt",10
dc.b "oder ist beschädigt.",0
NoCharText dc.b "Die Datei 'Char ROM' fehlt",10
dc.b "oder ist beschädigt.",0
NoParPortText dc.b "Der parallele Port ist zur Zeit",10
dc.b "von einem anderen Programm belegt.",10
dc.b "Die Benutzung von IEC-Geräten",10
dc.b "ist daher nicht möglich.",0
NoTimerText dc.b "Frodo kann keinen freien CIA-Timer finden.",10
dc.b "Die Benutzung von IEC-Geräten ist daher",10
dc.b "nicht möglich.",0
CNOP 0,4
; Requester
No68020Req dc.l 20,0
dc.l ReqTitle
dc.l No68020Text
dc.l ReqGads
NoMemReq dc.l 20,0
dc.l ReqTitle
dc.l NoMemText
dc.l ReqGads
NoScreenReq dc.l 20,0
dc.l ReqTitle
dc.l NoScreenText
dc.l ReqGads
NoEGSReq dc.l 20,0
dc.l ReqTitle
dc.l NoEGSText
dc.l ReqGads
NoVilIntuiReq dc.l 20,0
dc.l ReqTitle
dc.l NoVilIntuiText
dc.l ReqGads
NoDisplayIDReq dc.l 20,0
dc.l ReqTitle
dc.l NoDisplayIDText
dc.l ReqGads
ScrTooSmallReq dc.l 20,0
dc.l ReqTitle
dc.l ScrTooSmallText
dc.l ReqGads
NoKernalReq dc.l 20,0
dc.l ReqTitle
dc.l NoKernalText
dc.l ReqGads
NoBasicReq dc.l 20,0
dc.l ReqTitle
dc.l NoBasicText
dc.l ReqGads
NoCharReq dc.l 20,0
dc.l ReqTitle
dc.l NoCharText
dc.l ReqGads
NoParPortReq dc.l 20,0
dc.l ReqTitle
dc.l NoParPortText
dc.l ReqGads2
NoTimerReq dc.l 20,0
dc.l ReqTitle
dc.l NoTimerText
dc.l ReqGads2
**
** Datenbereich
**
_UtilityBase dc.l 0
_IntuitionBase dc.l 0
_GfxBase dc.l 0
_GadToolsBase dc.l 0
_AslBase dc.l 0
_IconBase dc.l 0
_EGSBase dc.l 0
_VilIntuiBase dc.l 0
_CiaBase dc.l 0
_MiscBase dc.l 0
MainTask dc.l 0 ;Emulator-Haupttask
ScreenRequester dc.l 0 ;ScreenMode-Requester
DirRequester dc.l 0 ;Directory-Requester
RAMBlock dc.l 0 ;Zeiger auf Speicherbereich
TheClass dc.l 0 ;Für Preferences
TheGadget dc.l 0
TheCode dc.w 0
PrefsFromEmul dc.w 0 ;#0: Einstellungen vom Emulator aus aufgerufen
; Prefs-Icon
PrefsIcon dc.w WB_DISKMAGIC,WB_DISKVERSION
dc.l 0
dc.w 0,0,54,23
dc.w 4,1,1
dc.l PrefsI1,0,0,0,0
dc.w 0
dc.l 1
dc.b WBPROJECT,0
dc.l 0,0
dc.l NO_ICON_POSITION,NO_ICON_POSITION
dc.l 0,0,0
; Image für Prefs-Icon
PrefsI1 dc.w 0,0,54,22,8
dc.l PrefsI1Data
dc.b 255,0
dc.l 0
; Tags zum Setzen von Gadgets
SetDir8Tags dc.l GTST_String,PDir8
dc.l 0,0
SetDir9Tags dc.l GTST_String,PDir9
dc.l 0,0
SetDir10Tags dc.l GTST_String,PDir10
dc.l 0,0
SetDir11Tags dc.l GTST_String,PDir11
dc.l 0,0
SetIntegerTags dc.l GTIN_Number
SetIntTagsVal dc.l 0
dc.l 0,0
SetCheckTags dc.l GTCB_Checked,-1
dc.l 0,0
SetCycleTags dc.l GTCY_Active
SetCycTagsVal dc.l 0
dc.l 0,0
SetDIDTags dc.l GTTX_Text,ModeNameBuf+16
dc.l 0,0
DisableTags dc.l GA_Disabled,-1
dc.l 0,0
EnableTags dc.l GA_Disabled,0
dc.l 0,0
; Tags für ScreenMode-Requester
ScreenReqTags dc.l ASLSM_TitleText,ScreenHailText
dc.l ASLSM_SleepWindow,-1
dc.l 0,0
DoScreenReqTags dc.l ASLSM_InitialDisplayID
ScreenReqID dc.l 0
dc.l ASLSM_Window
ScreenReqWindow dc.l 0
dc.l 0,0
; Tags für den Directory-Requester
DirReqTags dc.l ASLFR_TitleText,DirHailText
dc.l ASLFR_SleepWindow,-1
dc.l ASLFR_Flags2,FRF_REJECTICONS|FRF_DRAWERSONLY
dc.l 0,0
DoDirReqTags dc.l ASLFR_InitialDrawer,DirName
dc.l ASLFR_Window
DirReqWindow dc.l 0
dc.l 0,0
**
** Icon-Daten
**
SECTION "CHIPDATA",DATA,CHIP
PrefsI1Data dc.w $0000,$0000,$0000,$0400,$0000,$0000,$0000,$0C00
dc.w $0003,$FFC0,$0000,$0C00,$000C,$0030,$0000,$0C00
dc.w $0010,$7E08,$0000,$0C00,$0020,$8104,$0000,$0C00
dc.w $0020,$4104,$0000,$0C00,$0020,$4104,$0000,$0C00
dc.w $0010,$8204,$0000,$0C00,$000F,$0C08,$0000,$0C00
dc.w $0000,$3010,$0000,$0C00,$0000,$4060,$0000,$0C00
dc.w $0000,$8180,$0000,$0C00,$0001,$0E00,$0000,$0C00
dc.w $0000,$8400,$0000,$0C00,$0000,$7800,$0000,$0C00
dc.w $0000,$8400,$0000,$0C00,$0000,$8400,$0000,$0C00
dc.w $0000,$7800,$0000,$0C00,$0000,$0000,$0000,$0C00
dc.w $0000,$0000,$0000,$0C00,$7FFF,$FFFF,$FFFF,$FC00
dc.w $FFFF,$FFFF,$FFFF,$F800,$D555,$5557,$D555,$5000
dc.w $D554,$001F,$F555,$5000,$D553,$FFCF,$F555,$5000
dc.w $D54F,$81F7,$F555,$5000,$D55F,$54FB,$F555,$5000
dc.w $D55F,$94FB,$FFD5,$5000,$D55F,$94F9,$7FF5,$5000
dc.w $D54F,$55F9,$7FD5,$5000,$D550,$53F5,$7FD5,$5000
dc.w $D555,$4FE5,$5F55,$5000,$D555,$3F95,$60D5,$5000
dc.w $D555,$7E7D,$6055,$5000,$D554,$F1FD,$6035,$5000
dc.w $D555,$79FF,$FFD5,$5000,$D555,$05FF,$F555,$5000
dc.w $D555,$797F,$F555,$5000,$D555,$797F,$F555,$5000
dc.w $D555,$055F,$F555,$5000,$D555,$5557,$D555,$5000
dc.w $D555,$5555,$5555,$5000,$8000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$000F,$E000,$0000
dc.w $0000,$0007,$E000,$0000,$0000,$0003,$E000,$0000
dc.w $0000,$0000,$6000,$0000,$0000,$0000,$1FC0,$0000
dc.w $0000,$0000,$1F80,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0070,$1F80,$0000,$0000,$00F0,$1FC0,$0000
dc.w $0000,$00FC,$6000,$0000,$0000,$007F,$E000,$0000
dc.w $0000,$003F,$E000,$0000,$0000,$001F,$E000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$000F,$E000,$0000
dc.w $0000,$0007,$E000,$0000,$0000,$0003,$E000,$0000
dc.w $0000,$0000,$6000,$0000,$0000,$0000,$1FC0,$0000
dc.w $0000,$0000,$1F80,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0070,$1F80,$0000,$0000,$00F0,$1FC0,$0000
dc.w $0000,$00FC,$6000,$0000,$0000,$007F,$E000,$0000
dc.w $0000,$003F,$E000,$0000,$0000,$001F,$E000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$000F,$E000,$0000
dc.w $0000,$0007,$E000,$0000,$0000,$0003,$E000,$0000
dc.w $0000,$0000,$6000,$0000,$0000,$0000,$1FC0,$0000
dc.w $0000,$0000,$1F80,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0070,$1F80,$0000,$0000,$00F0,$1FC0,$0000
dc.w $0000,$00FC,$6000,$0000,$0000,$007F,$E000,$0000
dc.w $0000,$003F,$E000,$0000,$0000,$001F,$E000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$000F,$E000,$0000
dc.w $0000,$0007,$E000,$0000,$0000,$0003,$E000,$0000
dc.w $0000,$0000,$6000,$0000,$0000,$0000,$1FC0,$0000
dc.w $0000,$0000,$1F80,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0070,$1F80,$0000,$0000,$00F0,$1FC0,$0000
dc.w $0000,$00FC,$6000,$0000,$0000,$007F,$E000,$0000
dc.w $0000,$003F,$E000,$0000,$0000,$001F,$E000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$000F,$E000,$0000
dc.w $0000,$0007,$E000,$0000,$0000,$0003,$E000,$0000
dc.w $0000,$0000,$6000,$0000,$0000,$0000,$1FC0,$0000
dc.w $0000,$0000,$1F80,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0070,$1F80,$0000,$0000,$00F0,$1FC0,$0000
dc.w $0000,$00FC,$6000,$0000,$0000,$007F,$E000,$0000
dc.w $0000,$003F,$E000,$0000,$0000,$001F,$E000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$000F,$E000,$0000
dc.w $0000,$0007,$E000,$0000,$0000,$0003,$E000,$0000
dc.w $0000,$0000,$6000,$0000,$0000,$0000,$1FC0,$0000
dc.w $0000,$0000,$1F80,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$1F00,$0000
dc.w $0000,$0070,$1F80,$0000,$0000,$00F0,$1FC0,$0000
dc.w $0000,$00FC,$6000,$0000,$0000,$007F,$E000,$0000
dc.w $0000,$003F,$E000,$0000,$0000,$001F,$E000,$0000
dc.w $0000,$0007,$C000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
**
** Nicht initialisierte Daten
**
SECTION "BSS",BSS
ModeNameBuf ds.b nif_SIZEOF ;Puffer für GetDisplayInfoData
DirName ds.b 256 ;Puffer für Directory-Requester
; Einstellungen
ThePrefs
Pdummy ds.w 1
PNormalCycles ds.w 1
PBadLineCycles ds.w 1
PCIACycles ds.w 1
PJoystick1On ds.w 1
PJoystick2On ds.w 1
PJoystickSwap ds.w 1
PDisplayID ds.l 1
PScreenType ds.w 1
PDir8 ds.b 256
PDir9 ds.b 256
PDir10 ds.b 256
PDir11 ds.b 256
PDrv8IsIEC ds.w 1
PDrv9IsIEC ds.w 1
PDrv10IsIEC ds.w 1
PDrv11IsIEC ds.w 1
PUseSIDCard ds.w 1
POtherIEC ds.w 1
PKeyboardYZ ds.w 1
PrefsLength = *-ThePrefs
END